package DuiXiang.src.ch10;

public class LeShiTV extends TV {
    private String brand;
    RemoteControl TVRemote;

    public LeShiTV(String color, double price, double screen, String brand, RemoteControl TVRemote) {
        super(color, price, screen);
        this.brand = brand;
        this.TVRemote = TVRemote;
    }

    @Override
    public void play() {//不能调用遥控器的get方法
        System.out.println("它可以通过" + this.TVRemote+ "播放电视节目。");
    }

    @Override
    public String toString() {
        return "这是一台" + this.brand + "电视，它的颜色是" + this.getColor() + "色，屏幕大小是" +
                this.getScreen() + "寸，价值￥" + this.getPrice() + "元。"
                ;
    }

    public void turnOn() {
        System.out.println("这台" + this.brand + "电视可以通过");
        TVRemote.turnOn();
        System.out.println("电视机屏幕亮了。。。");
    }

    public void turnOff() {
        System.out.println("这台" + this.brand + "电视可以通过");
        TVRemote.turnOff();
        System.out.println("电视机屏幕灭了。。。");
    }

    public void changeChannel() {
        TVRemote.changeChannel();
        System.out.println("现在播放的频道是CCTV1，节目是《刘老师讲Java》。。。");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public RemoteControl getTVRemote() {
        return TVRemote;
    }

    public void setTVRemote(RemoteControl TVRemote) {
        this.TVRemote = TVRemote;
    }
}
